package cn.com.blackboard.SISIntergrationBiz.controller;

import java.io.IOException;
import java.util.List;
import java.util.Locale;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.com.blackboard.DataModule4B2.BBDataUtils.LocaleUtil;
import cn.com.blackboard.DataModule4B2.model.TeacherCourseInfo;
import cn.com.blackboard.DataModule4B2.service.TeacherCourseInfoService;
import cn.com.blackboard.DataModule4B2.util.BatchResultModel;
  
@Controller
@RequestMapping("/teacherEnrollments")
public class TeacherCourseInfoController {  
	
	private static final Logger logger = LoggerFactory.getLogger(TeacherCourseInfoController.class);

    @Autowired  
    private TeacherCourseInfoService teacherCourseInfoService;
    
    @RequestMapping(value = "importTeacherEnroll") 
    @ResponseBody  
    public String importTeacherEnrollment(ModelMap modelMap) throws IOException{	
    	logger.info("into import teacherEnrollment");
    	List<BatchResultModel> list = teacherCourseInfoService.batchImportTeacherCourseInfo();
    	modelMap.addAttribute("resultModelList", list);
    	Locale locale = LocaleUtil.getLocale();
		modelMap.addAttribute("locale", locale.toString());
    	return "/import/importEnrollments";
    }

}  
